﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Data;
using IHISCETeim.BLL;
using IHISCETeim.Library;
using IHISCETeim.Model;


namespace IHISCETeim.Web.MachineSys.WModel
{
    public partial class WOITMDetailOutStock : PageBase
    {
        protected override Permission[] PowerKey
        {
            get
            {
                return new Permission[] { Permission.查看, Permission.新增 };
            }
        }

        protected override string DWZRef
        {
            get { return "WOITMDetailOutStock"; }
        }


        protected void Page_Load(object sender, EventArgs e)
        {
            if (GetRequestValue<string>("ajaxmethod", "") == "add")
            {
                addmenu();
            }
        }

        protected void addmenu()
        {
            string ItemCodes, OperateTypes, Quantitys, OperateUser, OperateDocNums, OperateRemarks;
            ItemCodes = GetRequestValue<string>("ItemCode", "");
            OperateTypes = GetRequestValue<string>("OperateType", "");
            Quantitys = GetRequestValue<string>("Quantity", "");
            OperateUser = User.RealName;
            OperateDocNums = GetRequestValue<string>("OperateDocNum", "");
            OperateRemarks = GetRequestValue<string>("OperateRemark", "");

            if (WOITMController.AddOutStockDetail(ItemCodes, OperateTypes, Quantitys, OperateUser, OperateDocNums, OperateRemarks) == 1)
            {
                SuccessJson("已成功出库");
            }
            else
            {
                AlertJson("出库失败");
            }

        }

        protected string GetOutOperateType()
        { 
            //<select name="OperateType">
            //                    <option value="配件部借用">配件部借用</option>
            //                    <option value="" selected>其它</option>
            //               </select>
            string[] items = new string[] { "其它","配件部借用","生产零散发料" };
            string optiontemp = " <option value='{0}'>{0}</option>";
            string rstr = "";
            foreach (string itm in items)
            {
                rstr += string.Format(optiontemp, itm);
            }
            return string.Format("<select name=\"OperateType\">{0}</select>", rstr);

        }
    }
}